<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script src="${ctxStatic}/jquery/jquery-1.9.1.min.js"></script>
<html>
<head>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<link rel="stylesheet" href="${ctxStatic}/css/list_erp.css">
<link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
<style>
	body{
		width: 100%;
		height: 100%;
		overflow: auto
	}

	.materialContactTemp{
		padding-top: 40px;
	}
	
	td{
		padding: 20px 0;
	}
</style>
<script type="text/javascript">
	$(document).ready(function(){
	});
	/* 断料一览查询  */
	function searchContact(flag) {
		var url = "${ctx}/searchMaterialBreak";
		var contactNo = $("#contractCustom").val();
		params = {
			"contactNo":contactNo,
			"makeFlag":flag
		}
		$.post(url,params,function(result){
			$("#materialContactTemp").html($(callBackHtml(result)).find("#materialContactTemp").html());
		},'html')
	}
	/* 断料窗口  */
	function popoJsp(materialName,materialId,orderId,orderNo,materialUnitExpend) {
		popup('950px','600px','${ctx}/searchMaterialAll?contactNo=' +$("#contractCustom").val()
				+'&materialName='+materialName
				+ '&materialId=' + materialId
				+ '&orderId=' + orderId
				+ '&orderNo=' + orderNo
				+ '&makeFlag=' + $("#makeFlag").val()
				+ '&materialUnitExpend=' + materialUnitExpend
				);
	}
	/* 修改缝制方式区分  */
	function changeMakeFlag(flag){
		$("#makeFlag").val(flag);
	}
</script>
</head>
<body>
<div>
	<div style="top:20px;height: 50px;margin-top:20px;margin-bottom:30px;">
		<div style="width: 50%;float: left;margin-left:10px; margin-top: 10px;">
			<p class="searchTxt" style="font-size: 32px;width: 25%;position: relative;top: 15px;"><spring:message code='broken_material_contractNo'/>:</p>
			<div>
				<select id="contractCustom" style="width: 75%;font-size: 32px;height: 60px;" >
					<c:forEach items="${contractCustomList}" var="contract">
						<option value="${contract.contractNo}">${contract.contractNo}</option>
					</c:forEach>
				</select>
			</div>
		</div>
		<div style="width: 40%;float: right;margin-top: 10px;">
		<input type="hidden" id="makeFlag" value="0"/>
			<button style="width: 41%; height: 50px;margin-top:-10px;font-size: 26px;float: left;position: relative;top: 15px;"  type="button" onclick="searchContact(0);changeMakeFlag(0)"><spring:message code='search_machine'/></button>
			<button style="width: 41%; height: 50px;margin-top:-10px;font-size: 26px;float: left;margin-left: 20px;position: relative;top: 15px;"  type="button" onclick="searchContact(1);changeMakeFlag(1)"><spring:message code='search_handle'/></button>					
		</div>
	</div>
	<div id="materialContactTemp" class="materialContactTemp">
		<table style=" border:0px" cellspacing="0">
			<tr style="background-color:#f1f3f2;">
				<!-- 合同号 -->
				<th style="width:420px;font-size: 32px;"><spring:message code='broken_material_contractNo'/></th>
				<!-- 物料 -->
				<th style="width:350px;font-size: 32px;"><spring:message code='broken_material_materialName'/></th>
				<!-- 面料总单耗 -->
				<th style="width:350px;font-size: 32px;"><spring:message code='broken_material_consumption'/></th>
				<th style="width:250px;font-size: 32px;"></th>
			</tr>
		</table>
		<table style=" border:0px;" cellspacing="0" >
			<c:forEach items="${materialBreakList}"  var="materialBreak">
				<tr style="background-color:#f1f3f2;">
					<td style="width:420px;text-align:center;font-size: 32px;border-bottom: 1px solid #000;">
						<p>${materialBreak.contractCustomEntity.contractNo}</p>
					</td>
					<td id="contractMaterial" style="width:350px;text-align:center;font-size: 32px;border-bottom: 1px solid #000;">
						<p>${materialBreak.styleMaterialEntity.materialName}</p>
					</td>
					<td style="width:350px;text-align:center;font-size: 32px;border-bottom: 1px solid #000;">
						<p>${materialBreak.styleMaterialEntity.materialUnitExpend}</p>
					</td>
					<td style="width:250px;text-align:center;font-size: 32px;border-bottom: 1px solid #000;">
						<c:if test="${materialBreak.styleOperatingEntity.operatingStatus ne '0'}">
							<button class="${materialBreak.styleMaterialEntity.materialName}" style="width: 72%; height: 56px;margin-top:-8px;font-size: 30px;background:#595959;color:#ffffff;border:none;border-radius:3px;"  type="button" value="${materialBreak.styleMaterialEntity.materialName}" onclick="popoJsp(this.value,'${materialBreak.styleMaterialEntity.materialId}','${materialBreak.orderEntity.orderId}','${materialBreak.orderEntity.orderNo}','${materialBreak.styleMaterialEntity.materialUnitExpend}')"><spring:message code='button_broken_material'/></button>
						</c:if>
						<c:if test="${materialBreak.styleOperatingEntity.operatingStatus eq '0'}">
							<button class="${materialBreak.styleMaterialEntity.materialName}" disabled="disabled" style="width: 72%; height: 56px;margin-top:-8px;font-size: 30px;background:#DDDDDD;color:#ffffff;border:none;border-radius:3px;"  type="button" value="${materialBreak.styleMaterialEntity.materialName}" onclick="popoJsp(this.value'${materialBreak.styleMaterialEntity.materialId}')">已断</button>
						</c:if>
					</td>
				</tr>
			</c:forEach>
		</table>
	</div>
</div>
</body>
</html>